import http from '../utils/http';

// 用户相关API
export const userApi = {
  // 获取当前用户信息
  getCurrentUser: () => http.get('/user/info'),
  
  // 更新用户信息
  updateUserInfo: (userData) => http.put('/user/info', userData),
};

// 应用相关API
export const appApi = {
  // 获取应用数据
  getAppData: (appId) => http.get(`/apps/${appId}`),
  
  // 提交表单数据
  submitData: (data) => http.post('/apps/data', data),
};

// 通用API调用方法
export const commonApi = {
  // GET请求
  get: (url, params) => http.get(url, { params }),
  
  // POST请求
  post: (url, data) => http.post(url, data),
  
  // PUT请求
  put: (url, data) => http.put(url, data),
  
  // DELETE请求
  delete: (url) => http.delete(url),
};

export default {
  user: userApi,
  app: appApi,
  common: commonApi,
};